<template>
  <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="特殊资源">
        <el-radio-group v-model="form.resource">
          <el-radio label="线上品牌商赞助"></el-radio>
          <el-radio label="线下场地免费"></el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即创建</el-button>
        <el-button>取消</el-button>
      </el-form-item>
      {{ dialogData }}
    </el-form>
  </el-dialog>
</template>

<script>
import axios from 'axios'

export default {
  data() {
    return {
      dialogVisible: true,
      form: {
        resource: '',
      },
      dialogData: {},
      resUrl: 'seller',
      commonRes: [],
    }
  },
  methods: {
    add(options) {
      this.dialogData = Object.assign({}, this.dialogData, options)
      this.dialogVisible = this.dialogData.show
      this.resUrl = this.dialogData.resUrl
      this.getCommonRes()
    },
    async getCommonRes() {
      const { data } = await this.$http.get(this.resUrl)
      this.commonRes = data
    },
    async onSubmit() {
      console.log('submit!')
      const { data: mapData } = await axios.post(
        'https://jsonplaceholder.typicode.com/posts'
      )
      console.log(mapData)
    },
  },
}
</script>

<style></style>
